package com.byq.mm.application.cluster.provider;

import java.util.HashMap;
import java.util.Map;


import com.byq.mm.abstractx.cluster.client.ClusterClient;
import com.byq.mm.abstractx.cluster.provider.ClusterProvider;
import com.byq.mm.application.cluster.client.PlayerClient;

import com.byq.mm.abstractx.cluster.server.ClusterServer;
import com.byq.mm.abstractx.cluster.server.executor.Executor;


import com.byq.mm.application.cluster.server.PlayerServer;
import com.byq.mm.application.cluster.server.executor.PlayerExecutor;
import com.byq.mm.foundation.cluster.datatype.AttributeValue;
import com.byq.mm.foundation.cluster.datatype.BooleanValue;
import com.byq.mm.foundation.cluster.datatype.IntValue;
import com.byq.mm.foundation.cluster.datatype.StringListValue;

public class PlayerProvider implements ClusterProvider {
	static public class Define{
		static public final String CLUSTER_NAME = "player";
		public static class Attributes{
			static public final String ACTIVE = "active";
			static public final String PLAYLIST = "play_list";
			static public final String VOLUME = "volume";
			static public final String CURRENT_INDEX = "current_index";
			static public final String PROGRESS = "progress";
			static public final String STATUS = "status";
			static public final String CURRENT_LENGTH= "current_length";
			

		}
		public static class ClientCommand {
			static public final String MUTE = "mute";
		}
		public static Map<String, Class<? extends AttributeValue>> attributeTypes = new HashMap<String, Class<? extends AttributeValue>>();
		static{
			attributeTypes.put(PlayerProvider.Define.Attributes.ACTIVE, BooleanValue.class);
			attributeTypes.put(PlayerProvider.Define.Attributes.STATUS, IntValue.class);
			attributeTypes.put(PlayerProvider.Define.Attributes.CURRENT_INDEX, IntValue.class);
			attributeTypes.put(PlayerProvider.Define.Attributes.PROGRESS, IntValue.class);
			attributeTypes.put(PlayerProvider.Define.Attributes.VOLUME, IntValue.class);
			attributeTypes.put(PlayerProvider.Define.Attributes.CURRENT_LENGTH, IntValue.class);
			attributeTypes.put(PlayerProvider.Define.Attributes.PLAYLIST, StringListValue.class);
			

		}
		

		public static Map<String, AttributeValue> init() {
			Map<String, AttributeValue> attributes = new HashMap<String, AttributeValue>();
			attributes.put(PlayerProvider.Define.Attributes.STATUS,new IntValue(0));
			attributes.put(PlayerProvider.Define.Attributes.VOLUME,new IntValue(0));
			attributes.put(PlayerProvider.Define.Attributes.CURRENT_INDEX,new IntValue(0));
			attributes.put(PlayerProvider.Define.Attributes.PROGRESS,new IntValue(0));
			attributes.put(PlayerProvider.Define.Attributes.CURRENT_LENGTH,new IntValue(100));
			attributes.put(PlayerProvider.Define.Attributes.PLAYLIST,new StringListValue());
			attributes.put(PlayerProvider.Define.Attributes.ACTIVE,new BooleanValue(false));
			return attributes;
		}
	}
	@Override
	public String getClusterIdentifier() {
		// TODO Auto-generated method stub
		return Define.CLUSTER_NAME;
	}

	@Override
	public Class<? extends ClusterClient> getCusterClientType() {
		// TODO Auto-generated method stub
		return PlayerClient.class;
	}

	@Override
	public Class<? extends ClusterServer> getCusterServerType() {
		// TODO Auto-generated method stub
		return PlayerServer.class;
	}

	@Override
	public Class<? extends Executor> getExecutorType() {
		// TODO Auto-generated method stub
		return PlayerExecutor.class;
	}

}
